package com.example.skycode6.servlet;

import com.example.skycode6.bean.NoticeBean;
import com.example.skycode6.dao.NoticeDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/noticefront.html")
public class NoticeFrontServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    //1.获取新闻信息
    NoticeDao noticeDao = new NoticeDao();
    List<NoticeBean> notice = noticeDao.getList(1);
    //2.传递新闻信息给前端页面
    req.setAttribute("notice", notice);
    //3.加载显示前端页面
    req.getRequestDispatcher("noticeFrontList.jsp").forward(req, resp);
}
}